<template>
  <div class="">生命周期</div>
</template>

<script setup>
// vue3的生命周期比较有规律
import { onMounted, onUnmounted } from 'vue'
console.log('---setup相当于created---')
const getData = () => {
  console.log('---发请求---')
}
getData()

onMounted(() => {
  console.log('--onMounted--发请求---操作dom')
})

onUnmounted(() => {
  console.log('--onUnmounted---')
})
</script>

<style scoped></style>
